I want to make a dialogue with some references to the current object, that will update itself as the current object in the module window is updated.
How do I install a callback or event listener to current object changes - or if that cant be done, a callback for mouse / key events in the current module window?
SystemAdmin - Thu Jul 09 00:13:05 EDT 2009 |
|
Re: current object callback / event djakad - Thu Jul 09 10:03:17 EDT 2009
There are few to zero options for this. For the most part, user-created dialog boxes only respond to user-input (generally mouse clicks, but can also be mouse-overs and key-presses for canvases, and other things, but always direct user-input). Furthermore, there is no way to get a dialog box to automatically respond to changes or user-input to a related module.
About the only option that comes to mind is the undocumented function timer(). You'll have to search this forum for how to use it. But, in general, timer() creates a hidden DBE within the DB. You then use startTimer and stopTimer to activate/deactivate the timer. The timer will then execute a user-defined function at regular intervals (the quickest possible rate is every 0.1 seconds)
|
|
Re: current object callback / event djakad - Thu Jul 09 10:32:53 EDT 2009 djakad - Thu Jul 09 10:03:17 EDT 2009
There are few to zero options for this. For the most part, user-created dialog boxes only respond to user-input (generally mouse clicks, but can also be mouse-overs and key-presses for canvases, and other things, but always direct user-input). Furthermore, there is no way to get a dialog box to automatically respond to changes or user-input to a related module.
About the only option that comes to mind is the undocumented function timer(). You'll have to search this forum for how to use it. But, in general, timer() creates a hidden DBE within the DB. You then use startTimer and stopTimer to activate/deactivate the timer. The timer will then execute a user-defined function at regular intervals (the quickest possible rate is every 0.1 seconds)
See the timer() example in the following post
https://www.ibm.com/developerworks/forums/thread.jspa?messageID=14254497�
|
|
Re: current object callback / event Peter_Albert - Fri Jul 10 03:41:07 EDT 2009
Hmm, I never worked with attribute level triggers so far, but wouldn't they have the functionality the OP wants? With the caveat that he has to define a separate trigger for every attribute in question. And with the second restriction that triggers are not for the faint-hearted ...
Peter
|
|
Re: current object callback / event SystemAdmin - Fri Jul 10 04:19:07 EDT 2009 Peter_Albert - Fri Jul 10 03:41:07 EDT 2009
Hmm, I never worked with attribute level triggers so far, but wouldn't they have the functionality the OP wants? With the caveat that he has to define a separate trigger for every attribute in question. And with the second restriction that triggers are not for the faint-hearted ...
Peter
Attached is an example object trigger script saved from the old forum (?). Do not know who wrote this example, but it maybe does what was wanted.
Attachments
attachment_14272428_Trigger_example_object_sync.dxl
|
|
Re: current object callback / event SystemAdmin - Sun Jul 12 20:36:48 EDT 2009
Cheers for the responses. Looks like the only really feasable technigue is using the timer to poll.
|
|
Re: current object callback / event SystemAdmin - Sun Jul 12 22:33:23 EDT 2009 SystemAdmin - Sun Jul 12 20:36:48 EDT 2009
Cheers for the responses. Looks like the only really feasable technigue is using the timer to poll.
@teamj: Your original question is not clearly defined. Do you want to create a dialog box that contains fields that automatically update when a different object becomes the "current" object? Or do you want the dialog box fields to automatically update when attributes of the current object are modified?
A dynamic trigger is a better choice than a timer in both of these cases. In the first case, an object-level, post-sync dynamic trigger could be used (much like the one provided by Pekka). In the second case, an attribute-level, post-save dynamic trigger could be used. Attached is an example of such a script.
Attachments
attachment_14272870_AttributePostSaveTrigger.dxl
|
|
Re: current object callback / event llandale - Mon Jul 13 13:07:11 EDT 2009
Back from Vacation. Here's a function stripped from one of my scripts that does what you want. It updates a dialog when you select a new object. I note with alarming curiosity that two triggers get defined, but the 'bad' one gets closed when you select a new object (as evidenced by the 'infoBox'). There seems to be no lingering harm when you suppress the print and infoBox.
DB dbShow
DBE dbeCurrObj
Module g_mCurr = current
//************************
void trigSyncObject(Trigger trg)
{ // Post object sync trigger code. Update the dialog when the user
// selects a new object.
print "trigSyncObject...\n" // <<<<<<<<<<<<<<<
Module mCurr = module(trg)
Object oCurr
if (null dbShow or !showing dbShow or null mCurr)
{ // Dialog has closed then the user selected a new Object.
// Delete the trigger:
// print "Deleting dynamic trigger\n"
delete(trg) // Delete the dynamic trigger from this module
infoBox("deleting trigger, dialog closed") // <<<<<<<<<<
return
}
if (mCurr == g_mCurr)
{
current = g_mCurr
oCurr = current
if (!null oCurr)
set(dbeCurrObj, identifier(oCurr) "")
} // end Object in my module clicked
} // end trigSyncObject()
dbShow = create("Curr object")
dbeCurrObj = field(dbShow, "CurrObj:", "", 10, true)
trigger(module->object, sync, 5, trigSyncObject) // Define Dynamic Trigger
realize(dbShow, 40, 40)
Object oCurr = current
if (!null oCurr) set(dbeCurrObj, identifier(oCurr) "")
show(dbShow)
|
|
Re: current object callback / event SystemAdmin - Wed Jul 15 02:30:21 EDT 2009 SystemAdmin - Sun Jul 12 22:33:23 EDT 2009
@teamj: Your original question is not clearly defined. Do you want to create a dialog box that contains fields that automatically update when a different object becomes the "current" object? Or do you want the dialog box fields to automatically update when attributes of the current object are modified?
A dynamic trigger is a better choice than a timer in both of these cases. In the first case, an object-level, post-sync dynamic trigger could be used (much like the one provided by Pekka). In the second case, an attribute-level, post-save dynamic trigger could be used. Attached is an example of such a script.
Brilliant! 'sync' - exactly what I was looking for. Somehow i managed to gloss over that keyword in the DXL help. Thanks!
|
|